package com.turing.post.transaction.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import com.turing.post.util.PCPSUtil;

@SuppressWarnings("serial")
@Entity
@Table(name = "MCHCHKACCDETAIL")
@IdClass(MchChkAccDetail.class)
public class MchChkAccDetail implements Serializable {
	/**
	 * 商户ID
	 */
	private String merchantNo;

	@Id
	@Column(name = "MERCHANTNO", nullable = false)
	public String getMerchantNo() {
		return merchantNo;
	}

	public void setMerchantNo(String merchantNo) {
		this.merchantNo = merchantNo;
	}

	/**
	 * 对帐日期
	 */
	private Date checkDate;

	@Id
	@Column(name = "CHECKDATE", nullable = false)
	public Date getCheckDate() {
		return checkDate;
	}

	public void setCheckDate(Date checkDate) {
		this.checkDate = checkDate;
	}

	/**
	 * 流水号
	 */
	private String tranSeqNo;

	@Id
	@Column(name = "TRANSEQNO", nullable = false)
	public String getTranSeqNo() {
		return tranSeqNo;
	}

	public void setTranSeqNo(String tranSeqNo) {
		this.tranSeqNo = tranSeqNo;
	}

	/**
	 * 商户请求流水号
	 */
	private String mrchSeqNo;

	@Column(name = "MRCHSEQNO", nullable = false)
	public String getMrchSeqNo() {
		return mrchSeqNo;
	}

	public void setMrchSeqNo(String mrchSeqNo) {
		this.mrchSeqNo = mrchSeqNo;
	}

	/**
	 * 卡号/会员卡号
	 */
	private String cardNo;

	@Column(name = "CARDNO", nullable = true)
	public String getCardNo() {
		return cardNo;
	}

	public void setCardNo(String cardNo) {
		this.cardNo = cardNo;
	}

	/**
	 * 交易码
	 */
	private String tranCode;

	@Column(name = "TRANCODE", nullable = false)
	public String getTranCode() {
		return tranCode;
	}

	public void setTranCode(String tranCode) {
		this.tranCode = tranCode;
	}

	/**
	 * 发生额
	 */
	private BigInteger amount;

	@Column(name = "AMOUNT", nullable = false)
	public BigInteger getAmount() {
		return amount;
	}

	public void setAmount(BigInteger amount) {
		this.amount = amount;
	}

	/**
	 * 商户明细
	 */
	private String isMrch;

	@Column(name = "ISMRCH", nullable = false)
	public String getIsMrch() {
		return isMrch;
	}

	public void setIsMrch(String isMrch) {
		this.isMrch = isMrch;
	}

	/**
	 * 系统明细
	 */
	private String isSys;

	@Column(name = "ISSYS", nullable = false)
	public String getIsSys() {
		return isSys;
	}

	public void setIsSys(String isSys) {
		this.isSys = isSys;
	}

	@Override
	public int hashCode() {
		return PCPSUtil.getObjectListHashCode(new Object[] { getMerchantNo(),
				getCheckDate(), getTranSeqNo() });
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof MchChkAccDetail))
			return false;
		MchChkAccDetail other = (MchChkAccDetail) obj;
		if (!PCPSUtil
				.compareObject(this.getMerchantNo(), other.getMerchantNo()))
			return false;
		if (!PCPSUtil.compareObject(this.getCheckDate(), other.getCheckDate()))
			return false;
		return PCPSUtil
				.compareObject(this.getTranSeqNo(), other.getTranSeqNo());
	}
}